<form name = "frm_<?php echo $this->validacao; ?>" method="post" action="<?php echo $this->action; ?>" id="frm_<?php echo $this->validacao; ?>" OnSubmit="return checkdados(this)">
<input type="hidden" name="idJuridica" value="<?php echo $this->juridica->id_juridica; ?>"/>
<input type="hidden" id="idCurrentTab" value=""/>
<!-- Tabs -->
<div id="tabs">
	<ul>
		<li><a href="#tabs-1">Dados da empresa</a></li>
		<li><a href="#tabs-2">Funcionários</a></li>
		<li><a href="#tabs-3">Histórico</a></li>
	</ul>
	
	<div id="tabs-1">
	<fieldset>
	<legend>Dados da empresa</legend>
	<ul>
		<li><label class="description">Cliente</label>
			<div>
				<input type="text" name="dsRazaoSocial" id="dsRazaoSocial" class="element text large" value="<?php echo $this->juridica->ds_razao_social;?>">
				<label>Razão Social</label>
			</div>
			
			<div>
				<input type="text" name="dsFantasia" id="dsFantasia" class="element text large" value="<?php echo $this->juridica->ds_nome;?>">
				<label>Fantasia</label>
			</div>
		</li>	
	
		<li><label class="description">Atividade</label>
		<div>
		<select name="idAtuacao" id="idAtuacao" class="element select large">
      		<?php echo UtilController::getOptionAtuacao($this->juridica->id_atuacao, 0);?>
    	</select>
    	</div> <p class="guidelines"><small>Principal área de atuação</small></p>
		</li>
		
		<li><label class="description">Contato</label>
			<div>
				<input type="text" name="dsSite" id="dsSite" class="element select large" value="<?php echo $this->juridica->ds_site;?>">
				<label>Site</label>
			</div>
			<div class="right">
				<input name="nrTelefone" type="text" id="nrTelefone" class="element select large" onKeyPress="return formata_keypress(this, '<?php echo StringFormat::maskFone();?>', (event ? event : Event))" value="<?php echo $this->juridica->nr_telefone;?>">
				<label>Telefone</label>
			</div>
			<div class="left">
				<input type="text" name="nrFax" id="nrFax" class="element select large" onKeyPress="return formata_keypress(this, '<?php echo StringFormat::maskFone();?>', (event ? event : Event))" value="<?php echo $this->juridica->nr_fax;?>">
				<label>Fax</label>
			</div>
		</li>	

		<li><label class="description">Documentos</label>
			<div class="right">
				<input type="text" name="dsCadastur" id="dsCadastur" class="element text large" value="<?php echo $this->juridica->ds_cadastur;?>">
				<label>CADASTUR</label>
			</div>			
			<div class="left">
				<input type="text" name="dsCnpj" id="dsCnpj" class="element text large" onkeypress="return formata_keypress(this, '<?php echo StringFormat::maskCNPJ();?>', (event ? event : Event))" value="<?php echo $this->juridica->ds_cnpj;?>">
				<label>CNPJ</label>
			</div>
	
			<div class="right">
				<input type="text" name="dsDocumento" id="dsDocumento" class="element text large" value="<?php echo $this->juridica->ds_outro_documento;?>">
				<label>Número do documento</label>
			</div>
			<div class="left">
				<input type="text" name="nmDocumento" id="nmDocumento" class="element text large" value="<?php echo $this->juridica->nm_outro_documento;?>">
				<label>Nome do documento</label>	
			</div>
			<div class="left">
				<input type="text" name="dsInscEstadual" id="dsInscEstadual" class="element text large" value="<?php echo $this->juridica->ds_insc_estadual;?>">
				<label>Inscrição Estadual</label>
			</div>			
		</li>	
		
		<li><label class="description">Endereço</label>
		<div class="left">			
			<input name="dsCaixaPostal" type="text" id="dsCaixaPostal" class="element text large" value="<?php echo $this->juridica->ds_caixa_postal;?>">	
			<label>CEP</label>
		</div>				
		<div class="right">
			<select name="idPais" id="idPais" class="element select large" onchange="carregarElementosDependentes($('#idPais').val(), 'idEstado', 'pais'); $('#idCidade').empty()"> 
      		<?php echo ModelController::getOptionObjetosDependentes('pais'); 
      		?>
			</select><label>País</label>
		</div>
		
		<div class="left">
			<select name="idEstado" id="idEstado" class="element select large" onchange="carregarElementosDependentes($('#idEstado').val(), 'idCidade', 'estado');">
			<?php if ($this->juridica->pais->id_pais!="" && $this->juridica->estado->id_estado!=""){
				echo ModelController::getOptionObjetosDependentes(null, 
																  null, 
																  $this->juridica->estado->id_estado, 
																  null, 
																  $this->juridica->pais);
			}?>
			</select>
			<label>Estado</label>
		</div>
		<div class="right">
			<select name="idCidade" id="idCidade" class="element select large">
			<?php if ($this->juridica->cidade->id_cidade!="" && $this->juridica->estado->id_estado!=""){
				echo ModelController::getOptionObjetosDependentes(null, 
																  null, 
																  $this->juridica->cidade->id_cidade, 
																  null, 
																  $this->juridica->estado);
			}?>				
			</select>
			<label>Cidade</label>			
		</div>
		
		<div>
			<input name="dsEndereco" type="text" id="dsEndereco" class="element text large" value="<?php echo $this->juridica->ds_endereco;?>">
			<label>Logradouro</label>
		</div>
		<div><table align="left" border="0" width="100%"><tr align="left" style="width: 100%;">
			<td><input name="nrEndereco" type="text" id="nrEndereco" class="element text large" value="<?php echo $this->juridica->nr_endereco;?>">
				<label>Número</label></td>
			<td><input name="dsComplemento" type="text" id="dsComplemento" class="element text large" value="<?php echo $this->juridica->ds_complemento;?>">
				<label>Complemento</label></td>
			<td><input name="dsBairro" type="text" id="dsBairro" class="element text large" value="<?php echo $this->juridica->ds_bairro;?>">
				<label>Bairro</label></td>
		</tr></table></div>
		<p class="guidelines"><small>Informe o CEP para carregar o endereço</small></p>
		</li>
		<li>
		<div class="demo">
		<div align="right">
			<input type="submit" name="salvar_juridica" value="<?php echo $this->buttonLabelJuridica;?>">
		</div>
		</div>
		</li>
	</ul>
	</fieldset>
	</div>
    
	<div id="tabs-2" style="width: 60%">
	<fieldset>
	<ul><legend>Funcionários</legend>
		<li>
		<div><p>
			<a id="bt_add" class="prev" href="#" onClick="habilitar_desabilitar('funcionario_empresa');">Adicionar</a>
		</p></div>
		</li>
	
		<div id="funcionario_empresa" <?php if ($this->fisica->id_fisica==0){?>style="display: none;"<?php }?>>	
			<input id="id_fisica" name="id_fisica" type="hidden" value="<?php echo $this->fisica->id_fisica;?>"/>
			<li><label class="description">Documentos</label>
				<div class="right">
					<input type="text" name="dsRg" id="dsRg" class="element text large" value="<?php echo $this->fisica->ds_rg;?>"/>
					<label>RG</label>
				</div>			
				<div class="left">
					<input type="text" name="dsCpf" id="dsCpf" class="element text large" onkeypress="return formata_keypress(this, '<?php echo StringFormat::maskCPF();?>', (event ? event : Event))" value="<?php echo $this->fisica->ds_cpf;?>"/>
					<label>CPF</label>
				</div>
			</li>
			
			<li><label class="description">Identificação</label>
				<div class="left">
					<input name="primeiro_nome" type="text" id="primeiro_nome" class="element text large obrigatorio" value="<?php echo $this->fisica->ds_nome;?>"/>
					<label>Nome</label>
				</div>
				<div class="right">
					<input name="ultimo_nome" type="text" id="ultimo_nome" class="element text large obrigatorio" value="<?php echo $this->fisica->ds_ultimo_nome;?>"/>
					<label>Sobrenome</label>
				</div>				
				<div class="left">
					<select name="idSexo" id="idSexo" class="element select large obrigatorio">
			    		<?php echo UtilController::getOptionSexo($this->fisica->sexo->id_sexo, 0);?>
			    	</select><label>Sexo</label>			
				</div>
				<div class="right">
					<select name="idCivil" id="idCivil" class="element select large obrigatorio">
			    		<?php echo UtilController::getOptionCivil($this->fisica->civil->id_civil, 0);?>
			    	</select><label>Estado civil</label>			
				</div>			
			</li>		
			<li><label class="description">Contato</label>
				<div>
					<input name="dsEmail" type="text" id="dsEmail" class="element text large obrigatorio" value="<?php echo $this->fisica->ds_email;?>"/>
					<label>E-mail</label>
				</div>	
				<div class="right">
					<input type="text" name="nrTelefoneFisica" id="nrTelefoneFisica" class="element text large" onkeypress="return formata_keypress(this, '<?php echo StringFormat::maskFone();?>', (event ? event : Event))" value="<?php echo $this->fisica->nr_telefone;?>"/>
					<label>Telefone</label>
				</div>				
				<div class="left">
					<input type="text" name="nrCelular" id="nrCelular" class="element text large obrigatorio" onkeypress="return formata_keypress(this, '<?php echo StringFormat::maskFone();?>', (event ? event : Event))" value="<?php echo $this->fisica->nr_celular;?>"/>
					<label>Celular</label>
				</div>						
			</li>
			<li>	
				<div class="left">
					<button class="icon-clean" id="clean_all"     name="clean_all"     href="#" onclick="limparFormulario('funcionario_empresa', 'salvar_funcionario'); return false;">Limpar</button>
				</div>
				<div class="rigth" align="right">
					<button class="icon-save" id="salvar_funcionario" name="salvar_funcionario" href="#" onclick="return checkDadosFisica('funcionario_empresa');"><?php echo $this->buttonLabelFisica; ?></button>
				</div>
			</li>			
		</div>
	</ul>
	</fieldset>
	<div style="margin: 0; width: 160%;">
	
		<?php
			$this->Grid($this->dadosConsulta,                 //$data
						array('Nome'      =>'ds_nome_credencial',    //$coluns
							  'Celular'   =>'nr_celular',
							  'Telefone'  =>'nr_telefone',
							  'E-mail'    =>'ds_email'),
						array('id' 			=> 'lista_funcionario',        //$attrs
                              'width'       => '100%',
							  'id'			=>'mytable',
							  'class'		=>'tablesorter'),     
						array('tipo_selecao'=> 'selecaoUnica'), //$checkBox
						array('editFunctionAjax'    => 'carregarFuncionario',
							  'deleteFunctionPost'  => $this->baseUrl.'/fisica/excluir?id=',
							  'checkFunctions'     => true),
						array('nr_celular' => 'telefone', /*nome da coluna e o tipo da mascara*/
							  'nr_telefone'=> 'telefone')
						);
		?>
	</div>
	</div>
	<div id="tabs-3">
	</div>
</div>
</form>
